# 定义animal类
# class Animal():
#     def __init__(self, name):
#         self.name = name
#
#
# # Dog继承animal
# class Dog(Animal):
#     def __init__(self, name):
#         Animal.__init__(self, name)
#         print("Dog")
#
#
# dog = Dog("tomcat")
# print(dog.__dict__)
# print(dog.name)

# 方法二：使用super进行调用
# 定义animal类
class Animal():
    def __init__(self, name):
        self.name = name


# Dog继承animal
class Dog(Animal):
    def __init__(self, name):
        super(Dog, self).__init__(name)
        print("Dog")


dog = Dog("tomcat")
print(dog.__dict__)
print(dog.name)
